﻿using DotNetCore.CAP;
using Microsoft.AspNetCore.Mvc;

namespace sixgod.User.Controllers
{
    [Route("[Controller]")]
    public class UserController:ControllerBase
    {
        private readonly ICapPublisher _publisher;

        public UserController(ICapPublisher publisher)
        {
            _publisher = publisher;
        }

        [HttpGet]
        public ActionResult<string> Test(string id)
        {
            _publisher.Publish("test",DateTime.Now);
            return id;
        }

        [CapSubscribe("test")]
        private void Runs(DateTime dt)
        {
            Console.WriteLine(dt);
        }
    }
}
